﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Script.Serialization;
using Entity;
using Business;
using System.Web.UI;

namespace NetFlow
{
    public partial class ProtocolAnalysis : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string filePath = Session["FilePath"].ToString(); // 替换为实际文件路径
                AnalysisBusiness analysisBusiness = new AnalysisBusiness();
                List<NetFlowEntity> netFlowList = analysisBusiness.ParseNetFlowData(filePath);

                // 序列化数据
                string jsonData = new JavaScriptSerializer().Serialize(netFlowList);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ChartData", $"var netFlowData = {jsonData};", true);
            }
        }
    }
}